package com.freewater.springboot.demo.resource.messagesource;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.Locale;

public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(AppConfig.class);
        applicationContext.refresh();
        applicationContext.registerShutdownHook(); // 注册jvm关闭回调，jvm关闭时一并关闭spring容器
        final SomeService someService = applicationContext.getBean(SomeService.class);
        System.out.println(someService.execute("someValue", Locale.CHINESE));
        System.out.println(someService.execute("someValue", Locale.ENGLISH));
    }
}
